/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean.session;

import entity.RawMaterialEntity;
import entity.VendorProductPriceEntity;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author wei
 */
@Stateless
public class VendorProductPriceEntityFacade extends AbstractFacade<VendorProductPriceEntity> {
    @PersistenceContext(unitName = "MacTeam-warPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public VendorProductPriceEntityFacade() {
        super(VendorProductPriceEntity.class);
    }
    public List<VendorProductPriceEntity> getPriceListFor1RawMaterial(String r) {
        String queryStr = "SELECT v FROM VendorProductPrice v JOIN v.rawMaterial r"
                + " WHERE r.productName = '" + r+"'";
              
        Query query = em.createQuery(queryStr);
        return query.getResultList();
    }
}
